package o;

import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.huawei.appgallery.assistantdock.base.externalaction.openviewaction.RemoteBuoyAction;
import com.huawei.appgallery.forum.posts.api.IPostDetailProtocol;
import com.huawei.appgallery.forum.section.api.ISectionDetailActivityProtocol;
import com.huawei.fastengine.fastview.download.utils.PackageUtils;
import com.huawei.gamebox.plugin.gameservice.bean.GameInfo;
import com.huawei.gamebox.plugin.gameservice.view.TransferActivity;
import com.huawei.hms.support.api.entity.hwid.HwIDConstant.ACTION;

public class bgf {
    private static bgf ॱ;

    public static synchronized bgf ˊ() {
        bgf o_bgf;
        synchronized (bgf.class) {
            if (ॱ == null) {
                ॱ = new bgf();
            }
            o_bgf = ॱ;
        }
        return o_bgf;
    }

    public void ॱ(Context context, String str) {
        int ˎ = ˎ();
        if (ˎ == 2) {
            ॱॱ(context, str);
            return;
        }
        fjb ˎ2 = fho.ˏ().ˋ("Section").ˎ("section_detail_activity");
        ISectionDetailActivityProtocol iSectionDetailActivityProtocol = (ISectionDetailActivityProtocol) ˎ2.ˊ();
        iSectionDetailActivityProtocol.setUri(str);
        iSectionDetailActivityProtocol.setKindId(ˎ);
        iSectionDetailActivityProtocol.setFromBuoy(true);
        iSectionDetailActivityProtocol.setAppId(ˋ());
        iSectionDetailActivityProtocol.setDomainId(ˏ());
        fam.ॱ().ॱ(context, cjl.ˋ("section_detail_activity"), ˎ2, true);
    }

    public void ˊ(Context context, String str) {
        if (context != null) {
            if (ˊ(context)) {
                ʼ(context, str);
                return;
            }
            dex o_caj = new caj(context);
            Bundle bundle = new Bundle();
            bundle.putString("SEGMENT_URI", str);
            bundle.putString("APPID", ˋ());
            fam.ॱ().ˏ(context, o_caj, bundle);
        }
    }

    private void ॱॱ(Context context, String str) {
        if (ˋ(context, str)) {
            fam.ॱ().ˊ(context, null, new Intent(ACTION.HWID_SCHEME_URL, Uri.parse("higame://com.huawei.gamebox?activityName=activityModule|Section@@@section_detail_activity&params={\"params\":[{\"name\":\"Uri\",\"type\":\"String\",\"value\":\"" + str + "\"}]}&thirdId=4026620")));
        }
    }

    private void ʼ(Context context, String str) {
        Bundle bundle = new Bundle();
        bundle.putString("SEGMENT_URI", str);
        bundle.putString("APPID", ˋ());
        Intent intent = new Intent(context, TransferActivity.class);
        intent.setAction(RemoteBuoyAction.RESUME_GAMEBOX_ACTION);
        intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_URI, "buoy_forum_section");
        intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_PARAM, bundle);
        intent.putExtra(RemoteBuoyAction.RESTORE_REPORTBI_URI, str);
        fam.ॱ().ˎ(context, TransferActivity.class, intent, true);
    }

    public void ˏ(Context context, String str) {
        if (ˎ() == 2) {
            ʽ(context, str);
            return;
        }
        fjb ˎ = fho.ˏ().ˋ("Posts").ˎ("post.detail.activity");
        IPostDetailProtocol iPostDetailProtocol = (IPostDetailProtocol) ˎ.ˊ();
        iPostDetailProtocol.setUri(str);
        iPostDetailProtocol.setAppId(ˋ());
        iPostDetailProtocol.setDomainId(ˏ());
        fam.ॱ().ॱ(context, cjl.ˋ("post.detail.activity"), ˎ, true);
    }

    private void ʽ(Context context, String str) {
        if (ˋ(context, str)) {
            fam.ॱ().ˊ(context, null, new Intent(ACTION.HWID_SCHEME_URL, Uri.parse("higame://com.huawei.gamebox?activityName=activityModule|Posts@@@post.detail.activity&params={\"params\":[{\"name\":\"Uri\",\"type\":\"String\",\"value\":\"" + str + "\"}]}&thirdId=4026620")));
        }
    }

    public void ˎ(Context context, String str) {
        if (context != null) {
            if (ˊ(context)) {
                ᐝ(context, str);
                return;
            }
            dex o_bzc = new bzc(context);
            Bundle bundle = new Bundle();
            bundle.putString("SEGMENT_URI", str);
            bundle.putString("APPID", ˋ());
            fam.ॱ().ˏ(context, o_bzc, bundle);
        }
    }

    private void ᐝ(Context context, String str) {
        Bundle bundle = new Bundle();
        bundle.putString("SEGMENT_URI", str);
        bundle.putString("APPID", ˋ());
        Intent intent = new Intent(context, TransferActivity.class);
        intent.setAction(RemoteBuoyAction.RESUME_GAMEBOX_ACTION);
        intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_URI, "buoy_forum_post");
        intent.putExtra(RemoteBuoyAction.REMOTE_BUOY_PARAM, bundle);
        intent.putExtra(RemoteBuoyAction.RESTORE_REPORTBI_URI, str);
        fam.ॱ().ˎ(context, TransferActivity.class, intent, true);
    }

    public boolean ˋ(Context context, String str) {
        if (erz.ˏ(context, PackageUtils.HWGAMEBOX_PACKAGE_NAME) && erz.ˎ(context, PackageUtils.HWGAMEBOX_PACKAGE_NAME) >= 90001300) {
            return true;
        }
        Intent intent = new Intent(context, TransferActivity.class);
        intent.setAction(RemoteBuoyAction.RESUME_GAMEBOX_ACTION);
        intent.putExtra(RemoteBuoyAction.RESTORE_REPORTBI_URI, str);
        fam.ॱ().ˎ(context, TransferActivity.class, intent, true);
        return false;
    }

    private ezo ॱ() {
        GameInfo gameInfo = null;
        fae ˏ = fam.ॱ().ˏ();
        if (ˏ != null) {
            gameInfo = ˏ.getGameInfo();
        }
        return ezs.ˏ().ˋ(gameInfo);
    }

    private String ˋ() {
        ezo ॱ = ॱ();
        if (ॱ != null) {
            return ॱ.ˋ();
        }
        return "";
    }

    private int ˎ() {
        ezo ॱ = ॱ();
        if (ॱ != null) {
            return ॱ.ᐝ();
        }
        return 0;
    }

    private String ˏ() {
        return ((bus) fho.ˏ().ˋ("Forum").ॱ(bus.class)).ˎ();
    }

    private boolean ˊ(Context context) {
        if (eqp.ᐝ() && ˎ() == 2 && !PackageUtils.HWGAMEBOX_PACKAGE_NAME.equals(context.getPackageName())) {
            return true;
        }
        return false;
    }
}
